<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GBufferedOutputStream</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="streaming.html" title="Streaming I/O">
<link rel="prev" href="GBufferedInputStream.html" title="GBufferedInputStream">
<link rel="next" href="GDataInputStream.html" title="GDataInputStream">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="GBufferedInputStream.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="streaming.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="GDataInputStream.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GBufferedOutputStream.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#GBufferedOutputStream.description" class="shortcut">Description</a>
                   | 
                  <a href="#GBufferedOutputStream.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#GBufferedOutputStream.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
                   | 
                  <a href="#GBufferedOutputStream.properties" class="shortcut">Properties</a>
</td></tr>
</table>
<div class="refentry">
<a name="GBufferedOutputStream"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GBufferedOutputStream.top_of_page"></a>GBufferedOutputStream</span></h2>
<p>GBufferedOutputStream — Buffered Output Stream</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GBufferedOutputStream.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gio/gio.h&gt;

                    <a class="link" href="GBufferedOutputStream.html#GBufferedOutputStream-struct" title="GBufferedOutputStream">GBufferedOutputStream</a>;
<a class="link" href="GOutputStream.html" title="GOutputStream"><span class="returnvalue">GOutputStream</span></a> *     <a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-new" title="g_buffered_output_stream_new ()">g_buffered_output_stream_new</a>        (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *base_stream</code></em>);
<a class="link" href="GOutputStream.html" title="GOutputStream"><span class="returnvalue">GOutputStream</span></a> *     <a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-new-sized" title="g_buffered_output_stream_new_sized ()">g_buffered_output_stream_new_sized</a>  (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *base_stream</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>);
<a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="returnvalue">gsize</span></a>               <a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-get-buffer-size" title="g_buffered_output_stream_get_buffer_size ()">g_buffered_output_stream_get_buffer_size</a>
                                                        (<em class="parameter"><code><a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a> *stream</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-set-buffer-size" title="g_buffered_output_stream_set_buffer_size ()">g_buffered_output_stream_set_buffer_size</a>
                                                        (<em class="parameter"><code><a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>);
<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-get-auto-grow" title="g_buffered_output_stream_get_auto_grow ()">g_buffered_output_stream_get_auto_grow</a>
                                                        (<em class="parameter"><code><a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a> *stream</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-set-auto-grow" title="g_buffered_output_stream_set_auto_grow ()">g_buffered_output_stream_set_auto_grow</a>
                                                        (<em class="parameter"><code><a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> auto_grow</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GBufferedOutputStream.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
   +----<a class="link" href="GOutputStream.html" title="GOutputStream">GOutputStream</a>
         +----<a class="link" href="GFilterOutputStream.html" title="GFilterOutputStream">GFilterOutputStream</a>
               +----GBufferedOutputStream
</pre>
</div>
<div class="refsect1">
<a name="GBufferedOutputStream.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GBufferedOutputStream implements
 <a class="link" href="GSeekable.html" title="GSeekable">GSeekable</a>.</p>
</div>
<div class="refsect1">
<a name="GBufferedOutputStream.properties"></a><h2>Properties</h2>
<pre class="synopsis">
  "<a class="link" href="GBufferedOutputStream.html#GBufferedOutputStream--auto-grow" title='The "auto-grow" property'>auto-grow</a>"                <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
  "<a class="link" href="GBufferedOutputStream.html#GBufferedOutputStream--buffer-size" title='The "buffer-size" property'>buffer-size</a>"              <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write / Construct
</pre>
</div>
<div class="refsect1">
<a name="GBufferedOutputStream.description"></a><h2>Description</h2>
<p>
Buffered output stream implements <a class="link" href="GFilterOutputStream.html" title="GFilterOutputStream"><span class="type">GFilterOutputStream</span></a> and provides 
for buffered writes. 
</p>
<p>
By default, <a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a>'s buffer size is set at 4 kilobytes.
</p>
<p>
To create a buffered output stream, use <a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-new" title="g_buffered_output_stream_new ()"><code class="function">g_buffered_output_stream_new()</code></a>, 
or <a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-new-sized" title="g_buffered_output_stream_new_sized ()"><code class="function">g_buffered_output_stream_new_sized()</code></a> to specify the buffer's size 
at construction.
</p>
<p>
To get the size of a buffer within a buffered input stream, use 
<a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-get-buffer-size" title="g_buffered_output_stream_get_buffer_size ()"><code class="function">g_buffered_output_stream_get_buffer_size()</code></a>. To change the size of a 
buffered output stream's buffer, use 
<a class="link" href="GBufferedOutputStream.html#g-buffered-output-stream-set-buffer-size" title="g_buffered_output_stream_set_buffer_size ()"><code class="function">g_buffered_output_stream_set_buffer_size()</code></a>. Note that the buffer's 
size cannot be reduced below the size of the data within the buffer.
</p>
</div>
<div class="refsect1">
<a name="GBufferedOutputStream.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GBufferedOutputStream-struct"></a><h3>GBufferedOutputStream</h3>
<pre class="programlisting">typedef struct _GBufferedOutputStream GBufferedOutputStream;</pre>
<p>
An implementation of <a class="link" href="GFilterOutputStream.html" title="GFilterOutputStream"><span class="type">GFilterOutputStream</span></a> with a sized buffer.
</p>
</div>
<hr>
<div class="refsect2">
<a name="g-buffered-output-stream-new"></a><h3>g_buffered_output_stream_new ()</h3>
<pre class="programlisting"><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="returnvalue">GOutputStream</span></a> *     g_buffered_output_stream_new        (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *base_stream</code></em>);</pre>
<p>
Creates a new buffered output stream for a base stream.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>base_stream</code></em> :</span></p></td>
<td>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> for the given <em class="parameter"><code>base_stream</code></em>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-buffered-output-stream-new-sized"></a><h3>g_buffered_output_stream_new_sized ()</h3>
<pre class="programlisting"><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="returnvalue">GOutputStream</span></a> *     g_buffered_output_stream_new_sized  (<em class="parameter"><code><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> *base_stream</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>);</pre>
<p>
Creates a new buffered output stream with a given buffer size.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>base_stream</code></em> :</span></p></td>
<td>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>a <a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> with an internal buffer set to <em class="parameter"><code>size</code></em>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-buffered-output-stream-get-buffer-size"></a><h3>g_buffered_output_stream_get_buffer_size ()</h3>
<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="returnvalue">gsize</span></a>               g_buffered_output_stream_get_buffer_size
                                                        (<em class="parameter"><code><a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a> *stream</code></em>);</pre>
<p>
Gets the size of the buffer in the <em class="parameter"><code>stream</code></em>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>a <a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the current size of the buffer.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-buffered-output-stream-set-buffer-size"></a><h3>g_buffered_output_stream_set_buffer_size ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_buffered_output_stream_set_buffer_size
                                                        (<em class="parameter"><code><a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>);</pre>
<p>
Sets the size of the internal buffer to <em class="parameter"><code>size</code></em>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>a <a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>a <a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-buffered-output-stream-get-auto-grow"></a><h3>g_buffered_output_stream_get_auto_grow ()</h3>
<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_buffered_output_stream_get_auto_grow
                                                        (<em class="parameter"><code><a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a> *stream</code></em>);</pre>
<p>
Checks if the buffer automatically grows as data is added.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>a <a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <em class="parameter"><code>stream</code></em>'s buffer automatically grows,
<a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-buffered-output-stream-set-auto-grow"></a><h3>g_buffered_output_stream_set_auto_grow ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_buffered_output_stream_set_auto_grow
                                                        (<em class="parameter"><code><a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> auto_grow</code></em>);</pre>
<p>
Sets whether or not the <em class="parameter"><code>stream</code></em>'s buffer should automatically grow.
If <em class="parameter"><code>auto_grow</code></em> is true, then each write will just make the buffer
larger, and you must manually flush the buffer to actually write out
the data to the underlying stream.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>a <a class="link" href="GBufferedOutputStream.html" title="GBufferedOutputStream"><span class="type">GBufferedOutputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>auto_grow</code></em> :</span></p></td>
<td>a <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1">
<a name="GBufferedOutputStream.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GBufferedOutputStream--auto-grow"></a><h3>The <code class="literal">"auto-grow"</code> property</h3>
<pre class="programlisting">  "auto-grow"                <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
<p>Whether the buffer should automatically grow.</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2">
<a name="GBufferedOutputStream--buffer-size"></a><h3>The <code class="literal">"buffer-size"</code> property</h3>
<pre class="programlisting">  "buffer-size"              <a href="./../glib/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a>                 : Read / Write / Construct</pre>
<p>The size of the backend buffer.</p>
<p>Allowed values: &gt;= 1</p>
<p>Default value: 4096</p>
</div>
</div>
<div class="refsect1">
<a name="GBufferedOutputStream.see-also"></a><h2>See Also</h2>
<a class="link" href="GFilterOutputStream.html" title="GFilterOutputStream"><span class="type">GFilterOutputStream</span></a>, <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>